#include "stdafx.h"
#include "ConfigManager.h"
#include "tinyxml.h"

CConfigManager* CConfigManager::instance = nullptr;

CConfigManager * CConfigManager::GetConfig()
{
	if (instance == nullptr) {
		instance = new CConfigManager();
		if (instance == nullptr)
			return nullptr;
	}

	return instance;
}

bool CConfigManager::Initialize(std::string configfile)
{
	if (configfile.size() == 0) {
		configfile = "config.xml";
	}

	TiXmlDocument doc(configfile.c_str());
	if (doc.LoadFile() == false)
		return false;
	
	return true;
}
